#include <iostream>

using namespace std;

const int N = 1e5 + 5;

int a[N];

void find_sum(int* a, int n, int s){
    int i = 0, j = 0;
    int sum = a[0];
    
    while (j < n){
        if (sum >= s){
            if (sum == s){
                cout << i << " " << j << endl;
            }

            sum -= a[i];
            ++i;

            if (i > j){
                sum = a[i];
                ++j;
            }
        }
        
        if (sum < s){
            ++j;
            sum += a[j];
        }
    }
}

int main(){
    int n;
    cin >> n;

    for (int i = 1; i <= n; i++){
        cin >> a[i];
    }

    int s;
    cin >> s;

    find_sum(a, n, s);

    return 0;
}
